#include "includes.h" 


signed int ideal_speed;
signed int pulse_count;
signed int speed_error; //理想与实际速度偏差值

void  Speed_Control(void) 
{
  speed_error = ideal_speed - pulse_count;  
          
        if(speed_error >= 10) //情况1，全加速  
        {  
            speed_go=30;  
        }  
          
        else if(speed_error > -10) //情况2，用PID减速  
        {  
            motor_pid();  
        }  
        else  
        {  
            speed_go=0;   
        }         

}

